package pl.diagnoser.client.dto;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.client.rpc.IsSerializable;

public class ObjectHistoryViewer implements IsSerializable {

	private EstimateDTO estimate;
	private List<SymptomDTO> symptoms;
	
	public ObjectHistoryViewer() {}
	public ObjectHistoryViewer( EstimateDTO estimate, List<SymptomDTO> symptoms ) {
		this.estimate = estimate;
		this.symptoms = symptoms;
	}
	
	
	public EstimateDTO getEstimate() {
		return this.estimate;
	}
	
	public void setEstimate(EstimateDTO estimate) {
		this.estimate = estimate;
	}
	
	public List<SymptomDTO> getSymptoms() {
		return this.symptoms;
	}
	
	public void setSymptoms(List<SymptomDTO> symptoms) {
		this.symptoms = symptoms;
	}
	
	public List<String> getSymptomsAsList() {
		List<String> retSymptoms = new ArrayList<String>(symptoms.size());
		for(SymptomDTO symptom : symptoms) {
			retSymptoms.add(symptom.getSymptomName());
		}
		
		return retSymptoms;
	}
	
	public String getSymptomsAsString() {
		String tmpSymptoms = "";
		int i=0;
		for(SymptomDTO symptom : symptoms) {
			i++;
			if(i<symptoms.size())
				tmpSymptoms += symptom.getSymptomName() + ", ";
			else
				tmpSymptoms += symptom.getSymptomName();
		}
		
		return tmpSymptoms;
	}
}
